package com.evil.common.application.dto.permission.app;

import com.evil.common.application.enums.ApplicationSourceTypeEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@NoArgsConstructor
public class CopyAppPermissionReqDTO {

    private Long enterpriseId;

    /**
     * 复制源
     */
    private AppPermissionSourceDTO source;

    /**
     * 复制目标
     */
    private AppPermissionSourceDTO target;

    /**
     * 需要替换的目标id
     */
    private Map<Long, Long> targetIdMap;

    /**
     * 权限变动通知
     */
    private NoticeBaseDTO notice;

    public CopyAppPermissionReqDTO(ApplicationSourceTypeEnum sourceTypeEnum, Long enterpriseId, Long sourceId, Long targetId) {
        this.enterpriseId = enterpriseId;
        this.source = new AppPermissionSourceDTO(sourceTypeEnum.getId(), sourceId);
        this.target = new AppPermissionSourceDTO(sourceTypeEnum.getId(), targetId);
        this.targetIdMap = null;
    }

    public CopyAppPermissionReqDTO(ApplicationSourceTypeEnum sourceTypeEnum, Long enterpriseId, Long sourceId, Long targetId, Map<Long, Long> targetIdMap) {
        this.enterpriseId = enterpriseId;
        this.source = new AppPermissionSourceDTO(sourceTypeEnum.getId(), sourceId);
        this.target = new AppPermissionSourceDTO(sourceTypeEnum.getId(), targetId);
        this.targetIdMap = targetIdMap;
    }
}
